<ol class="breadcrumb">
    <li><a href="#">奇妙云箱</a></li>
    <li>设备管理</li>
</ol>
<div class="panel panel-default">
    <div class="panel-heading">
        <span class="icon-hdd icon-large"></span>
        <span class="panel-title">设备列表</span>
        <% if(session.permissionMap[1007]){ %>
        <a href="/device/create" class="pull-right btn btn-success btn-sm" style="margin-top: -3px;">
            <span class="glyphicon glyphicon-plus"></span>
            <span>新增</span>
        </a>
        <% } %>
    </div>
    <div class="table-responsive">
        <table class="table table-hover table-striped">
            <thead>
            <tr>
                <th>设备号</th>
                <th>主标题（摇）</th>
                <th>副标题（摇）</th>
                <th>活动链接（摇）</th>
                <th>图标（摇）</th>
                <th>WIFI名称</th>
                <th>WIFI密码</th>
                <th>WIFI流量</th>
                <th>操作</th>
            </tr>
            </thead>
            <tfoot>
            <tr>
                <td colspan="9">
                    <nav class="twbsPagination"></nav>
                </td>
            </tr>
            </tfoot>
            <tbody>
            <% for(var i = 0;i < datas.length;i++){
                if (!datas[i]) {
                    continue;
                }
            %>

            <tr>
                <td><%= datas[i].sim %></td>
                <td><%= datas[i].page_title %></td>
                <td><%= datas[i].page_description %></td>
                <td><%= datas[i].page_url %></td>
                <td><img src="<%= datas[i].page_icon_url %>"
                         style="width: 20px;height: 20px;"></td>
                <td><%= datas[i].wifissid %></td>
                <td><%= datas[i].wifipass %></td>
                <td><%= datas[i].wifilimit %></td>
                <td>
                    <% if(session.permissionMap[1010]){ %>
                    <a class="btn btn-default btn-sm"
                       href="/device/wifi?id=<%= datas[i]._id %>&phone=<%= datas[i].sim %>">WIFI设置</a>
                    <% } %>
                    <% if(session.permissionMap[1011]){ %>
                    <a class="btn btn-default btn-sm"
                       href="/device/shake?id=<%= datas[i]._id %>&sim=<%= datas[i].sim %>">摇一摇设置</a>
                    <% } %>
                    <% if(session.permissionMap[1008]){ %>
                    <a class="btn btn-danger btn-sm" href="/device/remove?sim=<%= datas[i].sim %>"
                       onclick="return confirm('确定删除该Sim卡?')">删除</a>
                    <% } %>
                </td>
            </tr>
            <% } %>
            </tbody>
        </table>
    </div>
</div>
<script type="text/javascript">
    $(function () {
        //分页功能
        $('.twbsPagination').twbsPagination({
            totalPages: <%= pageCount %>,
            visiblePages: 10,
            href: '/device/list?num={{number}}&&sim=ok'
        });
    })
</script>